package com.dlsy.ygj.biz.vindicateData.impl;

import java.util.List;

import com.dlsy.ygj.biz.vindicateData.IFavouredPlanSectionBiz;
import com.dlsy.ygj.dao.vindicateData.IFavouredPlanSectionDAO;
import com.dlsy.ygj.dao.vindicateData.impl.FavouredPlanSectionDAO;
import com.dlsy.ygj.entity.FavouredPlanSection;

public class FavouredPlanSectioinBiz implements IFavouredPlanSectionBiz {

	private IFavouredPlanSectionDAO favouredPlanSectionDAO;
	
	

	public IFavouredPlanSectionDAO getFavouredPlanSectionDAO() {
		return favouredPlanSectionDAO;
	}

	public void setFavouredPlanSectionDAO(
			IFavouredPlanSectionDAO favouredPlanSectionDAO) {
		this.favouredPlanSectionDAO = favouredPlanSectionDAO;
	}

	public List<FavouredPlanSection> findAllByPlanId(Integer planId) {
		List<FavouredPlanSection> favouredPlanSections=favouredPlanSectionDAO.findAllByPlanId(planId);
		if(favouredPlanSections !=null && favouredPlanSections.size()>0){
			return favouredPlanSections;
		}
		return null;
	}

	public void save(List<FavouredPlanSection> favouredPlanSections) {
		favouredPlanSectionDAO.saveOrUpdateAll(favouredPlanSections);

	}

	public void updateFavouredPlanSection(
			FavouredPlanSection favouredPlanSection) {
		favouredPlanSectionDAO.update(favouredPlanSection);

	}
	
	public void updateAll(List<FavouredPlanSection> sections){
		favouredPlanSectionDAO.saveOrUpdateAll(sections);
	}

	public void delSection(Integer sectionId) {
		FavouredPlanSection favouredPlanSection=favouredPlanSectionDAO.findById(FavouredPlanSection.class, sectionId);
		favouredPlanSectionDAO.delete(favouredPlanSection);
		
	}

}
